
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.util.ArrayList,
                 com.scalar.chiptrack.utils.ConfigManager,
                 com.scalar.chiptrack.users.Functionality,
				 com.scalar.chiptrack.users.User"%>

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/systemJobSetup.do"/>

<html:html locale="true">

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel=stylesheet>
<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<BODY bgColor="#ffffff" leftMargin=0 topMargin=0 marginheight="0" marginwidth="0" >

<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js">
</script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js">
</script>

<script language='javascript'>

function save()
{
	var count = document.systemJobSetupForm.count.value;

	var emailid = '';
	for( i = 0; i < count; i++)
	{
		var value1 = eval("document.systemJobSetupForm.selectedValue"+i).checked;
		if( value1 == true)
		{
			if(emailid != '')
            {
				emailValue = eval("document.systemJobSetupForm.selectedValue"+i).value;
				if( emailValue != '')
                {
					emailid =  emailid +" , "+ emailValue;
				}
				else
				{
					emailid =  emailid;
				}
			}
			else
			{
				emailid =  eval("document.systemJobSetupForm.selectedValue"+i).value;
			}
		}
	}

    window.opener.document.systemJobSetupForm['job.emails'].value =  emailid;
    document.systemJobSetupForm.submit();
    window.close();
}



function reset(){
    document.systemJobSetupForm.reset();
}

function closeWindow(form) {
    window.opener.document.systemJobSetupForm.submit();
 	window.close();
}

</script>


<!-- from here your body starts -->

<html:form name="systemJobSetupForm" type="com.scalar.chiptrack.users.forms.SystemJobSetupForm" action="/systemJobSetup.do">
<table border="0" width="100%" align="center">
	<tr><td bgcolor="#993333" align="center" class="NArialW"><font color='#FFFFFF'>User's Mail IDs</font></td></tr>
</table>
<img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20>
<table border="0" width="90%" align="right">
	<tr>
		<td width="100%">
			<table border="0" width="100%" cellspacing='10' cellpadding='2' align='left'>
				<tr>
					<td align=right>
						 <a href="javascript:window.close();" title='Click here to close this window' onMouseOver="window.status='Click here to close this window';return true"><font class='NArialL'><b>[Close this window]</b></font></a>
					</td>
				</tr>
				<tr><td><chiptrack:errors styleClass='NArialL' /></td></tr>
				<tr><td><chiptrack:info styleClass='NArialL' /></td></tr>
				<tr><td align="left" class='NArialL'><FONT id="errors" styleClass="NArialL" color='FF0000'></font></td></tr>
			</table>
		</td>
	</tr>
	<tr>
		<td>
			<%
			   ArrayList usersMailIDs = (ArrayList) request.getAttribute("usersMailIDs");
				if( usersMailIDs != null && usersMailIDs.size() != 0 ) { %>

			   <table border="0" width="70%" align="center">
				<tr>
					<td width="5%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Select</font></font></td>
					<td width="15%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">User Name</font></font></td>
					<td width="15%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Email</font></font></td>

				</tr>
				<%   int Cnt = 0 ; %>
				<logic:iterate id="User" name="usersMailIDs" type="com.scalar.chiptrack.users.User">

				<% int bgcount = 0;

				%>
				<% bgcount = bgcount + 1; %>
				<tr>
				 <td nowrap width="5%" align="left" <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>><font class="NArialL">
				 <logic:equal name="User" property="isChecked" value="true">
				<input type="checkbox" name="selectedValue<%=Cnt%>" value='<%=User.getEmail()%>' CHECKED></font></td>
				</logic:equal>
				<logic:equal name="User" property="isChecked" value="false">
				<input type="checkbox" name="selectedValue<%=Cnt%>" value='<%=User.getEmail()%>' ></font></td>
				</logic:equal>

				<td nowrap width="15%" align="left" <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>><font class="NArialL">
				<bean:write name="User" property="firstName" />&nbsp;<bean:write name="User" property="lastName" /></font></td>
				<td nowrap width="15%" align="left" <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>><font class="NArialL">
				<bean:write name="User" property="email" /></font></td>
				</tr>
				<% Cnt = Cnt + 1; %>
				</logic:iterate>
				<input type="hidden" name="count" value ='<%=Cnt%>' >
				<tr><td class="NArialL" colspan=5><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=50></td></tr>
				<tr><td colspan=3 align=center>

				<a href="javascript:save()"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/submit.gif" width="53" height="17"></a>
				<a href="javascript:reset()"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17"></a>
				</td></tr>

				</table>


				<% }
				else
				{ %>
						 <table border="0" width="70%" align="center">
						<tr>
							<td width="5%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Select</font></font></td>
							<td width="15%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Contact Person</font></font></td>
							<td width="15%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Email</font></font></td>

						</tr>
						<tr>
							<td colspan="3" align="center" bgcolor="#FFFFEE"><font class="NArialL">
							<< Records not found >>
							</td>

						</tr>
						</table>

				<%
				}
				%>
		</td>
	</tr>
</table>
<input type="hidden" name="jobID" value ='<%=request.getParameter("jobID")%>' >
<input type="hidden" name="action" value="">
</html:form>

</body>

</html:html>